/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import type { ProColumns } from '@ant-design/pro-table';
import { Input } from 'antd';
import React from 'react';
import PreviewImage from '../AmountCashVerify/PreviewImage';

export type StringObjType = Record<string, string>;

export type FormValuesType = StringObjType;

export const applyStatusOptions: StringObjType[] = [
  {
    label: '全部',
    value: '10001',
    color: '',
  },
  {
    label: '已通过',
    value: '1',
    color: '#999',
  },
  {
    label: '待审核',
    value: '0',
    color: '#1890FF',
  },
  {
    label: '已拒绝',
    value: '2',
    color: 'red',
  },
];

export const applyFormColumn: ProColumns<StringObjType>[] = [
  {
    title: '申请状态',
    hideInTable: true,
    dataIndex: 'status',
    valueType: 'select',
    initialValue: '10001',
    fieldProps: {
      options: applyStatusOptions,
      allowClear: false,
    },
  },
  {
    title: '姓名',
    hideInTable: true,
    dataIndex: 'name',
    renderFormItem: () => {
      return <Input name='phone' placeholder='请输入提现人姓名' />;
    },
  },
  {
    title: '提现账户',
    hideInTable: true,
    dataIndex: 'account',
    renderFormItem: () => {
      return <Input name='phone' placeholder='请输入手机号账号' />;
    },
  },
];

export const applyCommonColumn: ProColumns<StringObjType>[] = [
  {
    title: '提现人姓名',
    dataIndex: 'name',
    align: 'center',
    search: false,
  },
  {
    title: '提现人身份证号',
    dataIndex: 'id_card_number',
    align: 'center',
    search: false,
  },
  {
    title: '平台标识',
    dataIndex: 'type',
    align: 'center',
    search: false,
    valueEnum: {
      courier: '快递员',
      dak: '驿站',
    },
  },
  {
    title: '提现账户',
    dataIndex: 'mobile',
    align: 'center',
    search: false,
  },
  {
    title: '提现金额',
    dataIndex: 'money',
    align: 'center',
    search: false,
  },
  {
    title: '提现支付宝账号',
    dataIndex: 'account',
    align: 'center',
    search: false,
  },
  {
    title: '上传证件材料',
    dataIndex: 'images',
    align: 'center',
    search: false,
    render: (_, reocrd) => (
      <PreviewImage images={[reocrd.id_pic || '', reocrd.paper_pic || ''].filter((item) => item)} />
    ),
  },
  {
    title: '申请人',
    dataIndex: 'apply_name',
    align: 'center',
    search: false,
  },
  {
    title: '申请时间',
    dataIndex: 'created_time',
    align: 'center',
    search: false,
  },
];

export const applyLogColumn: ProColumns<StringObjType>[] = [
  {
    title: '提现人姓名',
    dataIndex: 'name',
    align: 'center',
    search: false,
  },
  {
    title: '提现人身份证号',
    dataIndex: 'id_card_number',
    align: 'center',
    search: false,
  },
  {
    title: '平台标识',
    dataIndex: 'type',
    align: 'center',
    search: false,
    valueEnum: {
      courier: '快递员',
      dak: '驿站',
    },
  },
  {
    title: '提现账户',
    dataIndex: 'mobile',
    align: 'center',
    search: false,
  },
  {
    title: '提现金额',
    dataIndex: 'money',
    align: 'center',
    search: false,
  },
  {
    title: '提现支付宝账号',
    dataIndex: 'account',
    align: 'center',
    search: false,
  },
  {
    title: '上传证件材料',
    dataIndex: 'images',
    align: 'center',
    search: false,
    render: (_, reocrd) => (
      <PreviewImage images={[reocrd.id_pic || '', reocrd.paper_pic || ''].filter((item) => item)} />
    ),
  },
  {
    title: '申请人',
    dataIndex: 'apply_name',
    align: 'center',
    search: false,
  },
  {
    title: '申请时间',
    dataIndex: 'created_time',
    align: 'center',
    search: false,
  },
  {
    title: '审核状态',
    dataIndex: 'status',
    align: 'center',
    search: false,
    valueEnum: {
      '0': '待处理',
      '1': '已通过',
      '2': '已拒绝',
    },
  },
  {
    title: '扣款结果',
    dataIndex: 'deduction_status',
    align: 'center',
    search: false,
    valueEnum: {
      '0': '暂未扣款',
      '1': '扣款成功',
      '2': '扣款失败',
    },
  },
];
